/*
 * Copyright © 2017 eqxiu.com 北京中网易企秀科技有限公司  All rights reserved.
 */
package cn.hermit.data.json;

import cn.hermit.data.json.model.JSONArray;
import cn.hermit.data.json.model.JSONObject;
import cn.hermit.data.json.model.JSONValue;

/**
 * Constants definition for <tt>JSON</tt> parsing.
 * @see JSONParser
 * 
 * @author Jack Gao (Chinese name : GAO JIANGUO, Email : linux.gjg@gmail.com)
 * @date 13 Jun, 2014
 */
public interface JSON {

	/**
	 * Constant for token delimiters of <tt>JSON</tt> string.
	 * <p>
	 * <i>{</i> is the start symbol of a {@link JSONObject JSON Object} and <i>}</i> is the end symbol.
	 * <i>[</i> is the start symbol of a {@link JSONArray JSON Array} and <i>]</i> is the end symbol.
	 * <i>:</i> is the delimiter between JSON Key and <tt>JSONValue</tt>.
	 * <i>"</i> is the quote symbol of <tt>JSON Key</tt> or {@link JSONValue JSON Value}.
	 * <strong>Note that JSON string does not allow single quote <i>'</i></strong>.
	 * <i>,</i> is the delimiter of JSON Entry composed with JSON Key and {@link JSONValue JSON Value}
	 * </p>
	 */
	String TOKEN_DELIMS = "{}[]:\",";

	/**
	 * A status of <i>Deterministic finite automaton</i> for parsing JSON string.
	 * 
	 * <p>
	 * This status will be turned on when parser walks in a JSON string but outside JSON Object and JSON Array.<br/>
	 * It is used to declare the start or the end of JSON parsing.
	 * </p>
	 * 
	 */
	byte STATUS_JSON = 0;

	/**
	 * A status of <i>Deterministic finite automaton</i> for parsing JSON string.
	 * 
	 * <p>
	 * This status will be turned on when parser walks in a JSON Object<br/>
	 * </p>
	 */
	byte STATUS_OBJECT = 1;

	/**
	 * A status of <i>Deterministic finite automaton</i> for parsing JSON string.
	 * 
	 * <p>
	 * This status will be turned on when parser walks in a JSON Array
	 * </p>
	 */
	byte STATUS_ARRAY = 2;

	/**
	 * A status of <i>Deterministic finite automaton</i> for parsing JSON string.
	 * 
	 * This status will be turned on when parser walks in a <i>JSON Entry</i>
	 * <i>JSON Entry</i> is a key value pair in JSON Object, e.g.<pre>
	 * "name":"Jack Gao"
	 * </pre>
	 * 
	 */
	byte STATUS_ENTRY = 3;

	/**
	 * It is a default JSON key in root level of JSON Object. 
	 * 
	 * In some cases, a JSON string need to take a root key.<br/>
	 * e.g. Convert a JSON fragment to XML fragment.
	 * The JSON fragment without root key is below:
	 * <pre>
	 * {"key0":"val0","key1":"val1"}
	 * </pre>
	 * But XML requires a root element.
	 * Add a root named <tt>JSON</tt> for JSON fragment.
	 * Then the converted XML will be:<pre>
	 * &lt;JSON&gt;
	 * 	&lt;key0&gt;val0&lt;/key0&gt;
	 * 	&lt;key1&gt;val1&lt;/key1&gt;
	 * &lt;/JSON&gt;
	 * </pre>
	 * 
	 */
	String DEFAULT_JSON_ROOT = "JSON";

	/**
	 * According to JSON specification, JSON value can be null.<br>
	 * But for some cases, the null value need to be replaced by client possibly.<br>
	 * Here setHeader the default null value is <i>null</i>.
	 */
	String DEFAULT_NULL_VALUE = "null";

	/**
	 * Define the default empty value against {@link JSON#DEFAULT_NULL_VALUE null value}
	 */
	String DEFAULT_EMPTY_VALUE = "";

}